package com.huang.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

//等价于<bean id="user" class="com.huang.pojo.User"/>
//组件@Component
@Component
@Scope("singleton")//singleton单例模式，prototype原型模式
public class User {
    //相当于:<bean id="user" class="com.huang.pojo.User">
    //        <property name="name" value="黄天"/>
    //    </bean>
    @Value("黄天")
    public String name;
    //相当于<property name="name" value="kuangshen" />
    @Value( "kuangshen")
    public void setName(String name) {
        this.name = name;
    }
}
